@extends('admin.layouts.wap_simple')
@section('title','添加备案模版')
@section('content')

<div class="mview-card-content">
    <div class="m-card" style="padding-top: 0;">
        <div class="m-card-header header-left">主体信息</div>
        <div class="m-form-item">
            <label><b>*</b>模板名称:</label>
            <input type="text" class="m-input" id="template_name" placeholder="请输入模板名称" value="{{ $templateBeian->remark }}">
            <input type="hidden" id="template_id" value="{{ $templateBeian->id }}">
        </div>
        <div class="m-form-item">
            <label><b>*</b>备案省市区:</label>
            <select class="m-select" id="base_info_province" style="max-width: 100px;">
                <option value="0">请选择</option>
            </select>
            <select class="m-select" id="base_info_city" style="max-width: 100px;">
                <option value="0">请选择</option>
            </select>
            <select class="m-select" id="base_info_district" style="max-width: 100px;">
                <option value="0">请选择</option>
            </select>
        </div>
        <div class="m-form-item">
            <label class="m-mr-1"><b>*</b>主体证件照片</label>
            <div>
                <a href="javascript:;" class="m-file" style="float:left;margin-left: 0px;">
                    <font>上传</font>
                    <input type="file" name="upload_license" id="upload_license" onchange="beianUpload('license',500,true,{},'all')">
                </a>
                <img src="" class="m-file-image" id="license_show" style="max-width: 300px;">
            </div>
        </div>
        <div class="m-form-item">
            <label><b>*</b>企业名称:</label>
            <input type="text" class="m-input" id="organize_info_certificate_name" onchange="inputChange(this);" placeholder="请输入企业名称" maxlength="40">
        </div>
        <div class="m-form-item">
            <label><b>*</b>证件号码:</label>
            <input type="text" class="m-input" id="organize_info_certificate_number" onchange="inputChange(this);" placeholder="请输入证件号码" maxlength="20">
        </div>
        <div class="m-form-item">
            <label><b>*</b>注册地址:</label>
            <input type="text" class="m-input" id="organize_info_certificate_address" onchange="inputChange(this);" placeholder="请输入注册地址" maxlength="50">
        </div>
        <div class="m-form-item">
            <label><b>*</b>通讯地址:</label>
            <input type="text" class="m-input" id="base_info_address" onchange="inputChange(this);" placeholder="请输入通讯地址" maxlength="50">
        </div>
        <div class="m-form-item">
            <label>主体备注:</label>
            <input type="text" class="m-input" id="base_info_comment" onchange="inputChange(this);" placeholder="请输入主体备注" maxlength="50">
        </div>
    </div>

    <div class="m-card">
        <div class="m-card-header header-left">主体负责人信息</div>
        <div class="m-form-item" id="principal_info_ul">
            <label class="m-mr-1"><b>*</b>是否为法人:</label>
            <li data="1">是</li>
            <li data="0">否</li>
            <input type="hidden" name="is_principal_info" value="1">
        </div>
        <div class="m-form-item data-3" style="display: none;">
            <label><b>*</b>法人名称:</label>
            <input type="text" class="m-input" id="legal_person_info_name" onchange="inputChange(this);" placeholder="请输入法人名称">
        </div>
        <div class="m-form-item data-3" style="display: none;">
            <label><b>*</b>法人证件号码:</label>
            <input type="text" class="m-input" id="legal_person_info_certificate_number" onchange="inputChange(this);" placeholder="请输入法人证件号码">
        </div>
        <div class="m-form-item">
            <label class="m-mr-1"><b>*</b>负责人证件人像面照片</label>
            <div>
                <a href="javascript:;" class="m-file" style="float:left;margin-left: 0px;">
                    <font>上传</font>
                    <input type="file" name="upload_legal_photo_front" id="upload_legal_photo_front" onchange="beianUpload('legal_photo_front',500,true,{},'all')">
                </a>
                <img src="" class="m-file-image" id="legal_photo_front_show" style="max-width: 300px;">
            </div>
        </div>
        <div class="m-form-item">
            <label class="m-mr-1"><b>*</b>负责人证件国徽面照片</label>
            <div>
                <a href="javascript:;" class="m-file" style="float:left;margin-left: 0px;">
                    <font>上传</font>
                    <input type="file" name="upload_legal_photo_back" id="upload_legal_photo_back" onchange="beianUpload('legal_photo_back',500,true,{},'all')">
                </a>
                <img src="" class="m-file-image" id="legal_photo_back_show" style="max-width: 300px;">
            </div>
        </div>
        <div class="m-form-item">
            <label><b>*</b>负责人名称:</label>
            <input type="text" class="m-input" id="principal_info_name" disabled placeholder="请输入负责人名称" maxlength="10">
        </div>
        <div class="m-form-item">
            <label><b>*</b>负责人证件号码:</label>
            <input type="text" class="m-input" id="principal_info_certificate_number" disabled placeholder="请输入负责人证件号码" maxlength="18">
        </div>
        <div class="m-form-item">
            <label><b>*</b>负责人联系方式:</label>
            <input type="text" class="m-input" id="principal_info_mobile" onchange="inputChange(this);" placeholder="请输入负责人联系方式" maxlength="18">
        </div>
        <div class="m-form-item">
            <label><b>*</b>负责人应急联系:</label>
            <input type="text" class="m-input" id="principal_info_emergency_contact" onchange="inputChange(this);" placeholder="请输入负责人应急联系方式" maxlength="18">
        </div>
        <div class="m-form-item">
            <label><b>*</b>负责人电子邮件:</label>
            <input type="text" class="m-input" id="principal_info_email" onchange="inputChange(this);" placeholder="请输入负责人电子邮件" maxlength="30">
        </div>
        <div class="m-form-item">
            <label><b>*</b>证件有效期起始日:</label>
            <input type="text" class="m-input" id="principal_info_certificate_validity_date_start" disabled placeholder="请输入负责人电子邮件" maxlength="8">
        </div>
        <div class="m-form-item">
            <label><b>*</b>证件有效期终止日:</label>
            <input type="text" class="m-input" id="principal_info_certificate_validity_date_end" disabled placeholder="请输入负责人电子邮件" maxlength="8">
        </div>
        <div class="m-form-item" id="shouquan" style="display: none;">
            <input type="hidden" id="isshouquan" value="1">
            <label class="m-mr-1"><b>*</b>授权书</label>
            <div>
                <a href="javascript:;" class="m-file" style="float:left;margin-left: 0px;">
                    <font>上传</font>
                    <input type="file" name="upload_authorization_letter" id="upload_authorization_letter" onchange="beianUpload('authorization_letter',500,true,{},'all')">
                </a>
                <img src="" class="m-file-image" id="authorization_letter_show" style="max-width: 300px;">
            </div>
        </div>
    </div>

    <div class="m-card" id="chengnuo" style="display: none;">
        <div class="m-card-header header-left">其他备案媒体材料</div>
        <div class="m-form-item">
            <label class="m-mr-1"><b>*</b>互联网信息服务承诺书</label>
            <div>
                <a href="javascript:;" class="m-file" style="float:left;margin-left: 0px;">
                    <font>上传</font>
                    <input type="file" name="upload_commitment_letter" id="upload_commitment_letter" onchange="beianUpload('commitment_letter',500,true,{},'all')">
                </a>
                <img src="" class="m-file-image" id="commitment_letter_show" style="max-width: 300px;">
            </div>
        </div>
    </div>
    <div class="m-form-item">
        <div class="m-form-btn m-btn-full" id="submitBeian" onclick="adminBeianUpdate();">立即更新企业备案模板</div>
    </div>
</div>
<input type="hidden" id="district" value="{{ json_encode($district) }}">
<style type="text/css">
    .m-form-item li{
        list-style: none;
        border: 1px solid #cccccc;
        height: 25px;
        line-height: 25px;
        padding:0 5px;
        margin: 0 15px 0 0;
        overflow: hidden;
        font-size: 12px;
    }
    .active{
        color: #0c57d0!important;
        border-color: #0c57d0!important;
    }
</style>
<script type="text/javascript" src="/assets/admin/js/dev/template_beian_setting.98834a.js?v={{ time() }}"></script>
<script type="text/javascript" src="/assets/admin/js/dev/image.upload.875451.js?v={{ time() }}"></script>
<script src="https://file.wailian1.cn/admin/assets/admin/js/libs/image-conversion/conversion.js"></script>
<script type="text/javascript">
    var defaultBeianInfo = '{!! $templateBeian->beian_info !!}';
    var defaultBeianInfo = JSON.parse(defaultBeianInfo);
    var is_principal_info = ['120000','150000','610000','640000','650000','420000','430000','410000','310000','360000','500000','520000','530000','540000','450000','350000','230000','130000','370000','630000','330000','210000','440000'];//主体负责人必须是法人
    var need_principal_info = ['220000','140000','620000','320000','340000','510000'];//主体负责人不是法人需提供授权书
    var no_principal_info = ['110000','460000'];//主体负责人不是法人不需授权书
    var province_arr = JSON.parse($("#district").val()).items;
    var back_legal_person = '{{ $templateBeian->legal_person }}';
    var city_arr=[],districtlist=[];
    console.log(defaultBeianInfo);
    shuli();
    $("#base_info_province").change(function(){
        var province_code=$(this).children('option:selected').val();
        $("#base_info_city").html("<option value ='-1'>请选择</option>");
        if(province_code >=0){
            if(is_principal_info.includes(province_code)){
                $("#shouquan").hide();
                $("#isshouquan").val(1);
                $('#principal_info_ul li[data="1"]').trigger("click");
            }else if(need_principal_info.includes(province_code)){
                if($("#is_principal_info").val==1){
                    $("#shouquan").hide();
                    $("#isshouquan").val(1);
                }else{
                    $("#shouquan").show();
                    $("#isshouquan").val(2);
                }
            }else if(no_principal_info.includes(province_code)){
                $("#shouquan").hide();
                $("#isshouquan").val(1);
            }
            if(province_code == '440000'){
                $("#chengnuo").show();
            }else{
                $("#chengnuo").hide();
            }
            defaultBeianInfo.icp_subject.base_info.province = province_code;
            city_arr = province_arr.filter(province => province.code == province_code)[0].sub_list;
            $.each(city_arr, function(index, item) {
                $("#base_info_city").append("<option value ='"+item.code+"'>"+item.name+"</option>")
            });
        }else{
            defaultBeianInfo.icp_subject.base_info.province = '';
            $("#chengnuo").hide();
            $("#shouquan").hide();
            $("#isshouquan").val(2);
        }
    })
    $("#base_info_city").change(function(){
        var city_code=$(this).children('option:selected').val();
        $("#base_info_district").html("<option value ='-1' selected>请选择</option>");
        if(city_code >=0){
            defaultBeianInfo.icp_subject.base_info.city = city_code;
            var districtlist = city_arr.filter(city => city.code == city_code)[0].sub_list;
            $.each(districtlist, function(index, item) {
                $("#base_info_district").append("<option value ='"+item.code+"'>"+item.name+"</option>")
            });
        }else{
            defaultBeianInfo.icp_subject.base_info.city = '';
        }
    })
    $("#base_info_district").change(function(){
        var district_code=$(this).children('option:selected').val();
        if(district_code >=0){
            defaultBeianInfo.icp_subject.base_info.district = district_code;
        }else{
            defaultBeianInfo.icp_subject.base_info.district = '';
        }
    })
    function jsUploadCallBack(id,imageurl,imageName,updata,other) {
        if(['license','legal_photo_front','legal_photo_back'].includes(id)){
            $.ajax({
                "url": "/admin/miniapp/miniapp_beian_image",
                "type": "GET",
                "data": {"status":id,"imgurl":imageurl},
                success: function(res){
                    console.log(res);
                    if (res.status == "error") {
                        mviewToastr("error",res.msg);
                        $("#"+id+"_show").attr("src","");
                    } else {
                        if (id == "license") {
                            defaultBeianInfo.icp_subject.organize_info.certificate_image = imageurl;
                            defaultBeianInfo.icp_subject.base_info.name = res.data.certificate_name;
                            defaultBeianInfo.icp_subject.organize_info.certificate_address = res.data.certificate_address;
                            defaultBeianInfo.icp_subject.organize_info.certificate_number = res.data.certificate_number;
                            back_legal_person = res.data.legal_person;
                            var districtIndex = res.data.certificate_address.indexOf("区");
                            var cityIndex = res.data.certificate_address.indexOf("市");
                            if (districtIndex != -1) {
                                var address = res.data.certificate_address.substring(districtIndex+1);
                            } else {
                                if (cityIndex != -1) {
                                    var address = res.data.certificate_address.substring(cityIndex+1);
                                } else {
                                    var address = res.data.certificate_address;
                                }
                            }
                            address = address.replace('-','');
                            address = address.replace('(','');
                            address = address.replace(')','');
                            address = address.replace('（','');
                            address = address.replace('）','');
                            defaultBeianInfo.icp_subject.base_info.address = address;
                            $("#organize_info_certificate_name").val(res.data.certificate_name);
                            $("#organize_info_certificate_number").val(res.data.certificate_number);
                            $("#base_info_address").val(address);
                            $("#organize_info_certificate_address").val(res.data.certificate_address);
                        } else if (id == "legal_photo_front") {
                            defaultBeianInfo.icp_subject.principal_info.name = res.data.name;
                            defaultBeianInfo.icp_subject.principal_info.certificate_number = res.data.idcard;
                            defaultBeianInfo.icp_subject.principal_info.certificate_photo_front_img = imageurl;
                            $("#principal_info_name").val(res.data.name);
                            $("#principal_info_certificate_number").val(res.data.idcard);
                        } else if(id == "legal_photo_back"){
                            defaultBeianInfo.icp_subject.principal_info.certificate_validity_date_start = res.data.date_start;
                            defaultBeianInfo.icp_subject.principal_info.certificate_validity_date_end = res.data.date_end;
                            defaultBeianInfo.icp_subject.principal_info.certificate_photo_back_img = imageurl;
                            $("#principal_info_certificate_validity_date_start").val(res.data.date_start);
                            $("#principal_info_certificate_validity_date_end").val(res.data.date_end);
                        }
                    }
                },
                error: function(err){
                    console.log(err);
                    $("#addbutton").html(btnText).attr("onclick","submitAdd()");
                    mviewToastr("error","请求失败,请稍后重试！");
                    $("#alert_success").hide();
                }
            });
        }else{
            if(id=='authorization_letter'){
                defaultBeianInfo.icp_subject.principal_info.authorization_letter_img = imageurl;
            }else if(id='commitment_letter'){
                defaultBeianInfo.icp_materials.commitment_letter_back_img = imageurl;
            }
        }
    }
    function inputChange(obj) {
        var id = obj.id;
        var value = $("#"+id).val();
        if (id == "principal_info_email") {
            var emailCheck = isEmail(value);
            if (emailCheck) {
                defaultBeianInfo.icp_subject.principal_info.email = value;
            } else {
                mviewToastr("error","请输入正确的主体负责人邮箱!");
                return;
            }
        } else if (id == "principal_info_mobile") {
            var phoneCheck = isPhone(value);
            if (phoneCheck) {
                defaultBeianInfo.icp_subject.principal_info.mobile = value;
            } else {
                mviewToastr("error","请输入正确的手机号码!");
                return;
            }
        } else if (id == "principal_info_emergency_contact") {
            var phoneCheck = isPhone(value);
            if (phoneCheck) {
                defaultBeianInfo.icp_subject.principal_info.emergency_contact = value;
            } else {
                mviewToastr("error","请输入正确的应急手机号码!");
                return;
            }
            if(defaultBeianInfo.icp_subject.principal_info.emergency_contact.length == 11 && defaultBeianInfo.icp_subject.principal_info.mobile.length == 11 && defaultBeianInfo.icp_subject.principal_info.emergency_contact==defaultBeianInfo.icp_subject.principal_info.mobile){
                mviewToastr("error","手机号和应急手机号不能相同!");
                return;
            }
        } else if (id == "legal_person_info_name") {
            defaultBeianInfo.icp_subject.legal_person_info.name = value;
        } else if (id == "legal_person_info_name") {
            defaultBeianInfo.icp_subject.legal_person_info.legal_person_info_certificate_number = value;
        } else if (id == "organize_info_certificate_name") {
            defaultBeianInfo.icp_subject.base_info.name = value;
        } else if (id == "organize_info_certificate_number") {
            defaultBeianInfo.icp_subject.organize_info.certificate_number = value;
        } else if (id == "organize_info_certificate_address") {
            defaultBeianInfo.icp_subject.organize_info.certificate_address = value;
        } else if (id == "base_info_address") {
            defaultBeianInfo.icp_subject.base_info.address = value;
        }
    }
    function isEmail(str) {
        var reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
        return  reg.test(str);
    }

    function isPhone(str) {
        var re = /^1\d{10}$/
        if (re.test(str)){
            return true;
        }else{
            return false;
        }
    }

    function isValidIdCard(idCard) {
        const reg = /^(\d{17}(\d|X|x))$/;
        return reg.test(idCard);
    }

    function adminBeianUpdate(){
        var template_name = $("#template_name").val();
        if(template_name == "") {
            template_name = defaultBeianInfo.icp_subject.base_info.name;
        }
        if(defaultBeianInfo.icp_subject.base_info.province == '' || defaultBeianInfo.icp_subject.base_info.city == '' || defaultBeianInfo.icp_subject.base_info.district == ''){
            mviewToastr("error","请先选择备案地区！");
            return;
        }
        if(defaultBeianInfo.icp_subject.organize_info.certificate_image == ''){
            mviewToastr("error","请先上传营业执照！");
            return;
        }
        if(defaultBeianInfo.icp_subject.base_info.name == ''){
            mviewToastr("error","请先填写公司名称！");
            return;
        }
        if(defaultBeianInfo.icp_subject.base_info.address.length<5){
            mviewToastr("error","请认真填写通讯地址！");
            return;
        }
        if(defaultBeianInfo.icp_subject.organize_info.certificate_number.length < 10){
            mviewToastr("error","请先检查证件号码！");
            return;
        }
        if(defaultBeianInfo.icp_subject.organize_info.certificate_address == ''){
            mviewToastr("error","注册地址要和营业执照地址一致！");
            return;
        }
        if(defaultBeianInfo.icp_subject.principal_info.name == ''){
            mviewToastr("error","请先填写负责人名称");
            return;
        }
        if(!isPhone(defaultBeianInfo.icp_subject.principal_info.mobile)){
            mviewToastr("error","请正确填写负责人联系方式");
            return;
        }
        if(!isEmail(defaultBeianInfo.icp_subject.principal_info.email)){
            mviewToastr("error","请输入正确的主体负责人邮箱!");
            return;
        }
        if(!isPhone(defaultBeianInfo.icp_subject.principal_info.emergency_contact)){
            mviewToastr("error","请正确填写负责人应急联系方式");
            return;
        }
        if(!isValidIdCard(defaultBeianInfo.icp_subject.principal_info.certificate_number)){
            mviewToastr("error","请正确填写身份证号");
            return;
        }
        if(defaultBeianInfo.icp_subject.principal_info.certificate_validity_date_start.length != 8){
            mviewToastr("error","请正确填写负责人身份证起始日期");
            return;
        }
        if(defaultBeianInfo.icp_subject.principal_info.certificate_validity_date_end.length != 8 && defaultBeianInfo.icp_subject.principal_info.certificate_validity_date_end.length != 2){
            mviewToastr("error","请正确填写负责人身份证终止日期");
            return;
        }
        if(defaultBeianInfo.icp_subject.principal_info.certificate_photo_front_img.length < 10){
            mviewToastr("error","请上传负责人身份证人像面");
            return;
        }
        if(defaultBeianInfo.icp_subject.principal_info.certificate_photo_back_img.length < 10){
            mviewToastr("error","请上传负责人身份证国徽面");
            return;
        }
        if($('input[name="is_principal_info"]').val()==0){
            if(defaultBeianInfo.icp_subject.legal_person_info.name == ''){
                mviewToastr("error","请先填写法人名称");
                return;
            }
            if(!isValidIdCard(defaultBeianInfo.icp_subject.legal_person_info.certificate_number)){
                mviewToastr("error","请先填写正确法人身份证号");
                return;
            }
            if(defaultBeianInfo.icp_subject.legal_person_info.name != back_legal_person){
                mviewToastr("error","请正确填写企业法人名称");
                return;
            }
        }
        if($("#base_info_province").val()=='440000' && defaultBeianInfo.icp_materials.commitment_letter_back_img.length < 10){
            mviewToastr("error","广东省必须上传互联网信息服务承诺书！");
            return;
        }
        if($("#base_info_province").val()!='440000' ){
            defaultBeianInfo.icp_materials.commitment_letter_back_img = '';
        }
        if($("#isshouquan").val() == '2' && defaultBeianInfo.icp_subject.principal_info.authorization_letter_img.length < 10){
            mviewToastr("error","请先上传授权书！");
            return;
        }
        if($("#isshouquan").val() == 1){
            defaultBeianInfo.icp_subject.principal_info.authorization_letter_img = '';
        }
        $.ajax({
            "url": "/admin/template/beian_update_submit",
            "type": "GET",
            "data": {"beianInfo":JSON.stringify(defaultBeianInfo),"template_name":template_name,"province":defaultBeianInfo.icp_subject.base_info.province,"principal_info":defaultBeianInfo.icp_subject.principal_info.name,"legal_person":back_legal_person,"certificate_number":defaultBeianInfo.icp_subject.organize_info.certificate_number,"id":$("#template_id").val()},
            success: function(res){
                console.log(res);
                mviewToastr(res.status,res.msg);
                if(res.status == 'success'){
                    setTimeout(()=>{
                        window.location.replace('/admin/template/beian');
                    },1100)
                }
            },
            error: function(err){
                mviewToastr("error","请求失败,请稍后重试！");
            }
        });
    }

    function shuli(){
        $("#base_info_province").html("<option value ='-1'>请选择</option>");
        $.each(province_arr, function(index, item) {
            if(item.code == defaultBeianInfo.icp_subject.base_info.province){
                $("#base_info_province").append("<option selected value ='"+item.code+"'>"+item.name+"</option>");
                city_arr = item.sub_list;
            }else{
                $("#base_info_province").append("<option value ='"+item.code+"'>"+item.name+"</option>");
            }
        });
        $.each(city_arr, function(index, item) {
            if(item.code == defaultBeianInfo.icp_subject.base_info.city){
                $("#base_info_city").append("<option selected value ='"+item.code+"'>"+item.name+"</option>");
                districtlist = item.sub_list;
            }else{
                $("#base_info_city").append("<option value ='"+item.code+"'>"+item.name+"</option>");
            }
        });
        $.each(districtlist, function(index, item) {
            if(item.code == defaultBeianInfo.icp_subject.base_info.district){
                $("#base_info_district").append("<option selected value ='"+item.code+"'>"+item.name+"</option>");
                city_arr = item.sub_list;
            }else{
                $("#base_info_district").append("<option value ='"+item.code+"'>"+item.name+"</option>");
            }
        });
        $("#license_show").attr('src',defaultBeianInfo.icp_subject.organize_info.certificate_image);
        $("#organize_info_certificate_name").val(defaultBeianInfo.icp_subject.base_info.name);
        $("#organize_info_certificate_number").val(defaultBeianInfo.icp_subject.organize_info.certificate_number);
        $("#organize_info_certificate_address").val(defaultBeianInfo.icp_subject.organize_info.certificate_address);
        $("#base_info_address").val(defaultBeianInfo.icp_subject.base_info.address);
        $("#base_info_comment").val(defaultBeianInfo.icp_subject.base_info.comment);
        if(defaultBeianInfo.icp_subject.legal_person_info.certificate_number != "" && defaultBeianInfo.icp_subject.legal_person_info.certificate_number != defaultBeianInfo.icp_subject.organize_info.certificate_number){
            $("#principal_info_ul li[data='0']").addClass('active');
            $(".data-3").show();
            $("#is_principal_info").val(0);
            $("#legal_person_info_name").val(defaultBeianInfo.icp_subject.legal_person_info.name);
            $("#legal_person_info_certificate_number").val(defaultBeianInfo.icp_subject.legal_person_info.certificate_number);

        }else{
            $("#principal_info_ul li[data='1']").addClass('active');
            $(".data-3").hide();
            $("#is_principal_info").val(1);
        }
        $("#legal_photo_front_show").attr('src',defaultBeianInfo.icp_subject.principal_info.certificate_photo_front_img);
        $("#legal_photo_back_show").attr('src',defaultBeianInfo.icp_subject.principal_info.certificate_photo_back_img);
        $("#principal_info_name").val(defaultBeianInfo.icp_subject.principal_info.name);
        $("#principal_info_certificate_number").val(defaultBeianInfo.icp_subject.principal_info.certificate_number);
        $("#principal_info_mobile").val(defaultBeianInfo.icp_subject.principal_info.mobile);
        $("#principal_info_emergency_contact").val(defaultBeianInfo.icp_subject.principal_info.emergency_contact);
        $("#principal_info_email").val(defaultBeianInfo.icp_subject.principal_info.email);
        $("#principal_info_certificate_validity_date_start").val(defaultBeianInfo.icp_subject.principal_info.certificate_validity_date_start);
        $("#principal_info_certificate_validity_date_end").val(defaultBeianInfo.icp_subject.principal_info.certificate_validity_date_end);
        if(defaultBeianInfo.icp_subject.principal_info.authorization_letter_img == ''){
            $("#isshouquan").val(1);
            $("#shouquan").hide();
        }else{
            $("#isshouquan").val(2);
            $("#shouquan").show();
            $("#authorization_letter_show").attr('src',defaultBeianInfo.icp_subject.principal_info.authorization_letter_img);
        }
    }
</script>
@endsection
